Php color conversion function hex-rgb (convert the hexadecimal format to the decimal format ). Copy the code as follows :? Phpfunctionhex2rgb ($ color) {if ($ color [0] #) {$ coloursubstr ($ color, 1);} if (strlen ($ color) 6) {list ($ r, $ g, $ B)
Prologue
I saw a good foreign Article, Making annoying rainbows in javascript. in fact, I really wanted to translate it, but it was really difficult for a person who hadn't even passed cet6, some paragraphs seem to understand the meaning, but do not
RGB value conversion
Rbg is often used for image processing. It can be expressed in decimal (0-255) or hexadecimal (00-ff. A pound is equal to or equal to a hexadecimal value.The decimal number is represented by 0 to 9 digits. The
Go to a fixed-length hexadecimal string. If it is not enough, add 0javascript to find a value for the background color, so you have to parse it yourself.
The Code is as follows:
// Convert to a fixed-length hexadecimal string. If not, add
PHP function Chapter Details decimal, binary, octal, and 16 conversion Functions description font: [Increase decrease] type: Reprint
Chinese character coding Research series The first, the PHP function of the decimal, binary, octal and
Copy Code code as follows:
Go to a fixed-length hexadecimal string, not enough to fill 0
function Zero_fill_hex (num, digits) {
var s = num.tostring (16);
while (S.length s = "0" + s;
return s;
}
Damn it, how did you find out how to
The core of JavaScript color conversion is the transformation between transitions. RGB format is actually decimal notation, so the hexadecimal color and RGB color conversion is hexadecimal and decimal conversion between.
16 conversion to decimal is
Requirements Description
The company's UI design brother, has been diverted to Zeplin for a long time. Zeplin's design presentation The color value of the page is expressed in decimal RGB, and in most cases the color representation in Android
Requirements Description
The company's UI design younger brother, has been diverted to Zeplin for a long time. Zeplin's design shows that the color value of the page is expressed in decimal RGB, and that the colors in Android are most often
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.